package biz.datalk.industrialland.admin.modules.online.dynform.pojo.dto;

import biz.datalk.industrialland.admin.modules.online.dynform.pojo.po.DynformField;
import biz.datalk.industrialland.common.util.FieldUtil;
import com.google.common.collect.Lists;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.util.List;

/**
 * @author tarofang@163.com
 * @date 2019-12-17
 */
@Getter
@Setter
@ToString
public class DynformFieldDTO extends DynformField implements Serializable {
    private static final long serialVersionUID = 1877180995108247752L;

    private String fieldNameHump;

    /** 字段对应字典信息 */
    private List<DictItem> dicts;

    public DynformFieldDTO() {
        super();
    }

    public DynformFieldDTO(DynformField field) {
        super();
        this.setFieldNameHump(FieldUtil.underline2Hump(field.getFieldName()));
        this.setDicts(Lists.newArrayList());

        this.setId(field.getId());
        this.setCreateBy(field.getCreateBy());
        this.setCreateName(field.getCreateName());
        this.setCreateTime(field.getCreateTime());
        this.setUpdateBy(field.getUpdateBy());
        this.setUpdateName(field.getUpdateName());
        this.setUpdateTime(field.getUpdateTime());
        this.setSysOrgCode(field.getSysOrgCode());
        this.setIsValid(field.getIsValid());
        this.setIsDelete(field.getIsDelete());
        this.setTableId(field.getTableId());
        this.setFieldName(field.getFieldName());
        this.setFieldComment(field.getFieldComment());
        this.setFieldLength(field.getFieldLength());
        this.setFieldPointLength(field.getFieldPointLength());
        this.setFieldDefault(field.getFieldDefault());
        this.setFieldType(field.getFieldType());
        this.setFieldIsPk(field.getFieldIsPk());
        this.setFieldIsNull(field.getFieldIsNull());
        this.setFieldOrder(field.getFieldOrder());
        this.setPageIsShow(field.getPageIsShow());
        this.setPageIsShowList(field.getPageIsShowList());
        this.setPageShowType(field.getPageShowType());
        this.setPageShowTypeLength(field.getPageShowTypeLength());
        this.setPageIsQuery(field.getPageIsQuery());
        this.setPageMustInput(field.getPageMustInput());
        this.setValidType(field.getValidType());
        this.setDictTable(field.getDictTable());
        this.setDictCode(field.getDictCode());
        this.setDictText(field.getDictText());
        this.setOldFieldName(field.getOldFieldName());
        this.setFileMaxNum(field.getFileMaxNum());
        this.setPageContentDef(field.getPageContentDef());
        this.setPageContentHint(field.getPageContentHint());
        this.setGroupId(field.getGroupId());
        this.setGroupName(field.getGroupName());
    }
}
